// DailyProduct.java
package org.example.model;

import java.math.BigDecimal;

public class DailyProduct extends Product {
    private String material;
    private boolean isRecyclable;

    public DailyProduct(String id, String name, BigDecimal price, int quantity,
                        String material, boolean isRecyclable) {
        super(id, name, price, quantity);
        setMaterial(material);
        this.isRecyclable = isRecyclable;
    }

    // Getter和Setter方法
    public String getMaterial() { return material; }

    public void setMaterial(String material) {
        if (material == null || material.trim().isEmpty()) {
            throw new IllegalArgumentException("材质不能为空");
        }
        this.material = material;
    }

    public boolean isRecyclable() { return isRecyclable; }

    public void setRecyclable(boolean recyclable) {
        isRecyclable = recyclable;
    }

    @Override
    public void displayInfo() {
        System.out.println("=== 日用品信息 ===");
        System.out.println("ID: " + getId());
        System.out.println("名称: " + getName());
        System.out.println("价格: ¥" + getPrice());
        System.out.println("库存: " + getQuantity());
        System.out.println("材质: " + material);
        System.out.println("可回收: " + (isRecyclable ? "是" : "否"));
        System.out.println("-------------------");
    }
}